package com.coollang.smartbra.model;

import com.coollang.smartbra.http.ResponseData;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * @Auther: Timmy
 * @Data: 2017/7/14
 * @Fuction:
 */

public class SportRecordModel implements ResponseData {


    /**
     * code : 200
     * message : success
     * data : [{"count":0,"duration":0,"heartRate":0,"date":"2017-06-10"},{"count":0,"duration":0,"heartRate":0,"date":"2017-06-11"},{"count":0,"duration":0,"heartRate":0,"date":"2017-06-12"},{"count":0,"duration":0,"heartRate":0,"date":"2017-06-13"},{"count":0,"duration":0,"heartRate":0,"date":"2017-06-14"},{"count":0,"duration":0,"heartRate":0,"date":"2017-06-15"},{"count":0,"duration":0,"heartRate":0,"date":"2017-06-16"},{"count":0,"duration":0,"heartRate":0,"date":"2017-06-17"},{"count":0,"duration":0,"heartRate":0,"date":"2017-06-18"},{"count":0,"duration":0,"heartRate":0,"date":"2017-06-19"},{"count":0,"duration":0,"heartRate":0,"date":"2017-06-20"},{"count":0,"duration":0,"heartRate":0,"date":"2017-06-21"},{"count":0,"duration":0,"heartRate":0,"date":"2017-06-22"},{"count":0,"duration":0,"heartRate":0,"date":"2017-06-23"},{"count":0,"duration":0,"heartRate":0,"date":"2017-06-24"},{"count":0,"duration":0,"heartRate":0,"date":"2017-06-25"},{"count":0,"duration":0,"heartRate":0,"date":"2017-06-26"},{"count":0,"duration":0,"heartRate":0,"date":"2017-06-27"},{"count":0,"duration":0,"heartRate":0,"date":"2017-06-28"},{"count":0,"duration":0,"heartRate":0,"date":"2017-06-29"},{"count":0,"duration":0,"heartRate":0,"date":"2017-06-30"},{"count":0,"duration":0,"heartRate":0,"date":"2017-07-01"},{"count":0,"duration":0,"heartRate":0,"date":"2017-07-02"},{"count":0,"duration":0,"heartRate":0,"date":"2017-07-03"},{"count":0,"duration":0,"heartRate":0,"date":"2017-07-04"},{"count":0,"duration":0,"heartRate":0,"date":"2017-07-05"},{"count":0,"duration":0,"heartRate":0,"date":"2017-07-06"},{"count":0,"duration":0,"heartRate":0,"date":"2017-07-07"},{"count":0,"duration":0,"heartRate":0,"date":"2017-07-08"},{"count":0,"duration":0,"heartRate":0,"date":"2017-07-09"},{"count":0,"duration":0,"heartRate":0,"date":"2017-07-10"},{"count":0,"duration":0,"heartRate":0,"date":"2017-07-11"},{"count":800,"duration":1200,"heartRate":80,"date":"2017-07-12"},{"count":0,"duration":0,"heartRate":0,"date":"2017-07-13"},{"count":0,"duration":0,"heartRate":0,"date":"2017-07-14"}]
     */

    private int code;
    private String message;
    private List<DataBean> data;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public List<DataBean> getData() {
        return data;
    }

    public void setData(List<DataBean> data) {
        this.data = data;
    }

    public static class DataBean {
        /**
         * count : 0
         * duration : 0
         * heartRate : 0
         * date : 2017-06-10
         */

        private int count;
        private int duration;
        private int heartRate;
        private int fault;
        private String date;

        public int getCount() {
            return count;
        }

        public void setCount(int count) {
            this.count = count;
        }

        public int getDuration() {
            return duration;
        }

        public void setDuration(int duration) {
            this.duration = duration;
        }

        public int getHeartRate() {
            return heartRate;
        }

        public void setHeartRate(int heartRate) {
            this.heartRate = heartRate;
        }

        public String getDate() {
            return date;
        }

        public void setDate(String date) {
            this.date = date;
        }

        public long getTimeStamp() {
            return getLongTime(date);
        }

        public int getFault() {
            return fault;
        }

        public void setFault(int fault) {
            this.fault = fault;
        }

        private static long getLongTime(String str) {

            SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
            try {
                Date sDt3 = sf.parse(str);
                return sDt3.getTime() / 1000;
            } catch (ParseException e) {
                e.printStackTrace();
            }

            return 0;
        }

    }
}
